package com.huatai.user.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.huatai.user.entity.Permission;
import com.huatai.user.vo.PermissionVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 资源权限
 */
public interface PermissionMapper extends BaseMapper<Permission> {

	@Select("SELECT t.*,(SELECT permission_name FROM sys_permission WHERE id=t.parent_id) as pname" +
		" FROM (SELECT * FROM sys_permission ORDER BY sort ASC) t")
	List<PermissionVo> getPermissions();

	List<PermissionVo> getPermissionList(@Param("parent_id") Long parent_id);
}
